DEFINE MISSIONS 1       

DEFINE MISSION 0 AT @DOGFIGHT

DEFINE EXTERNAL_SCRIPTS 0

DEFINE UNKNOWN_EMPTY_SEGMENT 0

DEFINE UNKNOWN_THREADS_MEMORY 500

{$VERSION 3.1.0027}
var
 $PLAYER_CHAR: Player
end // var 
//Main thread starts here
03A4: name_thread 'MAIN' 
//Set the screen BLACK immediately
016A: fade 0 time 0           
01F0: set_max_wanted_level_to 6 
0111: toggle_wasted_busted_check 0 
00C0: set_current_time_hours_to 8 minutes_to 0 
//Create Player at Runway in Desert
04E4: unknown_refresh_game_renderer_at 323.5454 2540.254 
Camera.SetAtPos(323.5454, 2540.254, 15.8085)
$PLAYER_CHAR = Player.Create(#NULL, 323.5454, 2535.254, 15.8085)
Player.SetClothes($PLAYER_CHAR, "VEST", "VEST", Torso)
Player.SetClothes($PLAYER_CHAR, "JEANSDENIM", "JEANS", Legs)
Player.SetClothes($PLAYER_CHAR, "SNEAKERBINCBLK", "SNEAKER", Shoes)
Player.SetClothes($PLAYER_CHAR, "PLAYER_FACE", "HEAD", Head)  
Player.Build($PLAYER_CHAR)
01F5: $PLAYER_ACTOR = create_player_actor $PLAYER_CHAR 
07AF: $PLAYER_GROUP = player $PLAYER_CHAR group 
01B6: set_weather 1 
0001: wait 0 ms 
01B4: toggle_player $PLAYER_CHAR can_move false 
04BB: select_interior 0 
0629: change_integer_stat 181 to 4  //Unlocks ALL cities and ZONES!
016C: restart_if_wasted_at 323.5454 2535.254 15.8085 angle 90.0 town_number 0 
016D: restart_if_busted_at 323.5454 2535.254 15.8085 angle 90.0 town_number 0 
// Note: your missions have to use the variable defined here
0180: set_on_mission_flag_to $ONMISSION  
0004: $DEFAULT_WAIT_TIME = 250
03E6: remove_text_box 
// START GAME
$ONMISSION = 0   
//Free the players movements
016A: fade 1 time 500
0001: wait 1000 ms 
Player.CanMove($PLAYER_CHAR) = True
Camera.Restore_WithJumpCut
Camera.SetBehindPlayer
    
:MAIN_LOOP
0001: wait $DEFAULT_WAIT_TIME ms
00BF: $TIME_HOURS = current_time_hours, $TIME_MINS = current_time_minutes

if and
$ONMISSION == 0
00E1:   player 0 pressed_key 11
jf @MAIN_LOOP

start_mission 0

0002: jump @MAIN_LOOP 

:DOGFIGHT
thread 'DOGFIGHT' 
gosub @DOGFIGHT_100
if 
wasted_or_busted 
else_jump @DOGFIGHT_8000 

end_thread 

:DOGFIGHT_100
// Locks your player so you can't move just yet
Player.CanMove($PLAYER_CHAR) = False
100@ = 1
$ONMISSION = 1
//Load Models 
0395: clear_area 1 at 323.5454 2540.254 15.8085 radius 50.0 
Model.Load(#RUSTLER)
Model.Load(#WFYCLOT)    // Cool Female Pilots!!
038B: load_requested_models 
//Check for Models Loading
:DOGFIGHT_110
wait 0
if or
Model.Available(#RUSTLER)
Model.Available(#WFYCLOT)
jf @DOGFIGHT_110 

//Place my plane on the Airstrip
125@ = Car.Create(#RUSTLER, 323.5454, 2540.254, 15.8085 )
Car.Angle(125@) = 180.0
//126@ is an array of 2 integers 48@ is the index 
48@ = 0   //Place Plane #0
00A5: 126@(48@,2i) = create_car #RUSTLER at 421.3578 2515.6172 16.7772
Car.Angle(126@(48@,2i)) = 90.0
009A: 123@(48@,2i) = create_actor_pedtype 5 model #WFYCLOT at 424.3162 2509.3926 16.4844
Actor.Angle(123@(48@,2i)) = 90.0
48@ = 1   //Place Plane #1
00A5: 126@(48@,2i) = create_car #RUSTLER at 421.3578 2496.7336 16.7842
Car.Angle(126@(48@,2i)) = 90.0
009A: 123@(48@,2i) = create_actor_pedtype 5 model #WFYCLOT at 424.3162 2488.623 16.4922
Actor.Angle(123@(48@,2i)) = 90.0
//Let's get into the air!
Player.CanMove($PLAYER_CHAR) = True
  
:DOGFIGHT_120
wait 0
//Wait loop for CJ to get into the cockpit... I said cock. ;)
if
Actor.DrivingPlane($PLAYER_ACTOR)
jf @DOGFIGHT_120
//Ladies to your planes!
48@ = 0
05CB: AS_actor 123@(48@,2i) enter_car 126@(48@,2i) as_driver -1 ms 
48@ = 1
05CB: AS_actor 123@(48@,2i) enter_car 126@(48@,2i) as_driver -1 ms 

//Dramatic cut away shot
067C: put_camera_on_actor 123@(48@,2i) with_offset 12.0 -6.0 6.0 rotation 0.0 0.0 0.0 0.0 2 
wait 12000 
Camera.Restore_WithJumpCut
Camera.SetBehindPlayer


48@ = 0
04D2: set_plane 126@(48@,2i) fly_autopilot_around_point 328.9085 2503.646 200.0 altitude_between 0.0 and 250.0 
50@ = Marker.CreateAboveCar(126@(48@,2i))
07E0: set_marker 50@ type_to 0
0165: set_marker 50@ color_to 0 
48@ = 1
04D2: set_plane 126@(48@,2i) fly_autopilot_around_point -228.9085 2503.646 300.0 altitude_between 0.0 and 250.0 
51@ = Marker.CreateAboveCar(126@(48@,2i))
07E0: set_marker 51@ type_to 0
0165: set_marker 51@ color_to 0 
 {
//This code will have them launching missiles at you from their planes. Just remove the braces.
48@ = 0
070E: hydra 126@(48@,2i) attack_player_car $PLAYER_CHAR radius 10.0 
48@ = 1
070E: hydra 126@(48@,2i) attack_player_car $PLAYER_CHAR radius 10.0 
  }
:DOGFIGHT_900
if 
100@ == 0
then
48@ = 0
04D2: set_plane 126@(48@,2i) fly_autopilot_around_point 328.9085 2503.646 200.0 altitude_between 0.0 and 250.0
48@ = 1
04D2: set_plane 126@(48@,2i) fly_autopilot_around_point -228.9085 2503.646 300.0 altitude_between 0.0 and 250.0 
100@ = 1
end
if 
100@ == 2
then
48@ = 0
04D2: set_plane 126@(48@,2i) fly_autopilot_around_point -792.2631 2290.0559 271.8035 altitude_between 0.0 and 250.0
48@ = 1
04D2: set_plane 126@(48@,2i) fly_autopilot_around_point 328.9085 2503.646 200.0 altitude_between 0.0 and 250.0 
100@ = 3
end
if 
100@ == 4
then
48@ = 0
04D2: set_plane 126@(48@,2i) fly_autopilot_around_point 188.875 2489.7739 70.1775 altitude_between 0.0 and 250.0
48@ = 1
04D2: set_plane 126@(48@,2i) fly_autopilot_around_point -792.2631 2290.0559 271.8035 altitude_between 0.0 and 250.0 
100@ = 5
end
if 
100@ == 6
then
48@ = 0
04D2: set_plane 126@(48@,2i) fly_autopilot_around_point -228.9085 2503.646 300.0 altitude_between 0.0 and 250.0
48@ = 1
04D2: set_plane 126@(48@,2i) fly_autopilot_around_point 188.875 2489.7739 70.1775 altitude_between 0.0 and 250.0 
100@ = 7
end
if 
100@ == 0
then
48@ = 0
04D2: set_plane 126@(48@,2i) fly_autopilot_around_point 328.9085 2503.646 200.0 altitude_between 0.0 and 250.0
48@ = 1
04D2: set_plane 126@(48@,2i) fly_autopilot_around_point -228.9085 2503.646 300.0 altitude_between 0.0 and 250.0 
100@ = 1
end
48@ = 0
if
00F4:   actor 123@(48@,2i) near_actor $PLAYER_ACTOR radius 50.0 50.0 0 in_car 
then
100@ += 1
end
48@ = 1
if
00F4:   actor 123@(48@,2i) near_actor $PLAYER_ACTOR radius 50.0 50.0 0 in_car 
then
100@ += 1
end

wait 0
48@ = 0 
if
Car.Wrecked(126@(48@,2i)) 
jf @DOGFIGHT_900

wait 0
48@ = 1 
if
Car.Wrecked(126@(48@,2i)) 
jf @DOGFIGHT_900

return

:DOGFIGHT_8000 
030C: progress_made += 1 
0394: play_music 1 
Player.ClearWantedLevel($PLAYER_CHAR)
//01E3: show_text_1number_styled GXT 'M_PASSR' number 7 time 5000 style 1  // MISSION PASSED!~n~~w~RESPECT +
//0998: add_respect 1 
//When money is given you should use these lines.
01E3: show_text_1number_styled GXT 'M_PASS' number 2000 time 5000 style 1  // MISSION PASSED!~n~~w~$~1~
Player.Money($PLAYER_CHAR) += 2000
$ONMISSION = 0 
01BD: $CURRENT_TIME_IN_MS = current_time_in_ms
Model.Destroy(#RUSTLER)
Model.Destroy(#WFYCLOT)
mission_cleanup 

end_thread
